<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
if (isset($_SESSION['lang']))
    require_once "./language_files/viewMessage_" . $_SESSION['lang'] . ".php";
else
    require_once "./language_files/viewMessage_en.php";
?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title></title>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <link href="style3.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="functions.js"></script>
        <?php include 'jquery.php'; ?>
        <script type="text/javascript">
            $(document).ready(function(){
                check_top();

                labelM = top.document.getElementById("num_msg");
                $.ajax ({
                    type: 'POST',
                    url:  'seen_messages.php',
                    success: function(response) {
                        if(response == "0") {
                            $(labelM).html('');
                            $(labelM).removeClass("num_msg");
                        } else {
                            $(labelM).html(response);
                            $(labelM).addClass("num_msg");
                        }
                    }
                });
            });
        </script>
    </head>
    <body>
        <?
        require_once "functions.php";
        $m_id = $_GET['message_id'];
        $message_id = mysql_real_escape_string($m_id);
        $result = mysql_query("SELECT m.first_name, m.last_name, ms.subject, ms.message , ms.date_sent FROM
         member_message_member s , messages ms , member m
         Where  s.message_id=ms.message_id AND m.member_id=s.member_id1
            AND ms.message_id='$message_id'") or die(mysql_error());

        $row = mysql_fetch_assoc($result);
        echo "<fieldset>";
        ?><a class='float_left' id='return' href='viewMessages.php'> <?php echo $lang['back'] ?></a><br />
        <fieldset style='text-align:center; background-color:#003366; color:white; font-size: 16px;'>
            <?php
            $subject = formatText_safe($row['subject']);
            echo "{$subject}<br />";
            ?>

            <?php
            $f_name = formatText_safe($row['first_name']);
            $l_name = formatText_safe($row['last_name']);
            $data = formatText_safe($row['date_sent']);
            echo $lang['send'];
            ?> <?php echo $f_name . " " . $l_name; ?> <?php echo $lang['at'] . " " . $data; ?>
        </fieldset>
        <?php
        $msg = formatText_safe($row['message']);
        echo "<textarea style='width:99%' rows='30' readonly='true' class='Mdiv' >{$msg}</textarea>";
        echo "</fieldset>";
        ?>
    </body>
</html>